/*
Author:kermit
Email:455196886@qq.com
Company:http://dragontrail.com/
Creattime:2017-1-08
*/

//依赖jquery
var Fleet = function() {
	var  fleet = this;
	fleet.SwiperBannerInit = function(){
		var $fleetSwiper = $('#fleetSwiper'),
			$fleeInfo = $('#fleeInfo'),
			$nextBtn = $fleetSwiper.find('.fleet-button-next'),
			$prevBtn = $fleetSwiper.find('.fleet-button-prev'),
			$pagination = $fleetSwiper.find('.swiper-pagination');
		if(Common.screenWidth>=1024){
			$fleetSwiper.height($fleeInfo.outerHeight());
		}else{
			$fleetSwiper.height(400);
		}
		fleet.fleetSwiper = new Swiper($fleetSwiper, {
			autoplay: 5000,
			pagination: $pagination,
			paginationClickable :true,
			prevButton:$prevBtn,
			nextButton:$nextBtn,
			paginationBulletRender: function (swiper, index, className) {
				var _index = (index + 1)>9?index+1:'0'+(index+1);
				return '<span class="' + className + '">' + _index + '</span>';
			}
		})
	}
	//页面窗口变化
	fleet.WindowResize = function(){
		$(window).resize(function(event){
			fleet.fleetSwiper.destroy(false,true);
			fleet.SwiperBannerInit();
		});
	}
	fleet.Init = function() {
		fleet.SwiperBannerInit();
		fleet.WindowResize();
		console.log('Fleet init');
	}
}
var Fleet = new Fleet();
Fleet.Init();